<template>
  <div class="login-container">
    <h2>登录</h2>
    <form @submit.prevent="handleLogin">
      <div class="form-group">
        <label for="username">用户名</label>
        <input id="username" v-model="username" type="text" required />
      </div>
      <div class="form-group">
        <label for="password">密码</label>
        <input id="password" v-model="password" type="password" required />
      </div>
      <button type="submit">登录</button>
    </form>
    <div v-if="error" class="error">{{ error }}</div>
  </div>
</template>

<script>
export default {
  name: 'Login',
  data() {
    return {
      username: '',
      password: '',
      error: ''
    }
  },
  methods: {
    handleLogin() {
      if (!this.username || !this.password) {
        this.error = '请输入用户名和密码';
        return;
      }
      // 这里可以添加登录逻辑，比如调用API
      this.error = '';
      alert(`登录成功！用户名：${this.username}`);
    }
  }
}
</script>

<style scoped>
.login-container {
  max-width: 420px;
  margin: 100px auto;
  padding: 48px 36px 36px 36px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(60,60,60,0.10), 0 1.5px 6px rgba(60,60,60,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
}
h2 {
  margin-bottom: 32px;
  color: #222;
  font-weight: 600;
  font-size: 2rem;
  letter-spacing: 2px;
}
form {
  width: 100%;
}
.form-group {
  margin-bottom: 28px;
}
label {
  display: block;
  margin-bottom: 10px;
  color: #444;
  font-size: 1.1rem;
  font-weight: 500;
}
input {
  width: 100%;
  padding: 16px 14px;
  border: 1.5px solid #d0d7de;
  border-radius: 8px;
  font-size: 1.15rem;
  background: #f8fafc;
  transition: border 0.2s;
  outline: none;
  box-sizing: border-box;
}
input:focus {
  border: 1.5px solid #42b983;
  background: #fff;
}
button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(90deg, #42b983 60%, #369870 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(66,185,131,0.08);
  transition: background 0.2s;
}
button:hover {
  background: linear-gradient(90deg, #369870 60%, #42b983 100%);
}
.error {
  color: #e74c3c;
  margin-top: 18px;
  text-align: center;
  font-size: 1rem;
}
</style> 